Skip to content

Add compile-time validation for histogram buckets in foundations-macros #127

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LloydW93
Copy link

I recently had a bug in a service using foundations where the buckets in my histogram were not in ascending order because of a typo. Instead of this being detected and handled in any way, I just had a broken metric.

This change adds compile time checks when using the metrics proc macro to, if the buckets are provided directly, check the ordering. It doesn't check if they're passed from a variable or function or any other method, and I think the only way to do that would be runtime validation - the binary would consistently fail to start immediately, but have kept this constrained to a compile-time check for now to get thoughts/feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants